<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>块状元素水平居中</title>
    <style>
        .center{
            width: 1000px;
            height: 80px;
            border: 1px solid #000;
            margin: 10px auto;
        }
        /* 
            1. 固定宽度
            2. 水平方向margin为auto
        */
    </style>
</head>
<body>
    <div class="center"></div>
</body>
</html>